﻿using AgencyManagerSystem.AsmType;
using AgencyManagerSystem.Common;
using AgencyManagerSystem.DataFetcher;
using AgencyManagerSystem.DataUpdater;
using AgencyManagerSystem.Model;
using System;
using System.Collections.Generic;

namespace AgencyManagerSystem.Core
{
    public class DimensionUpdaterCreator : MainDetailUpdaterCreator<DimensionModel,DimensionDocModel>
    {
        DimensionFetcher dimensionFetcher = new DimensionFetcher();
        DimensionDocFetcher dimensionDocFetcher = new DimensionDocFetcher();
        public DimensionUpdater CreateDimensionUpdaterInstance()
        {
            var mainUpdater = DimensionUpdater.GetMainUpdater();
            mainUpdater.DataUpdating += FlagAndApproveFlagValid;
            mainUpdater.DataDeleting += dimensionUsed;
            var dimensionUpdater = new DimensionUpdater(dimensionFetcher, dimensionDocFetcher, mainUpdater);
            dimensionUpdater.DataBulkUpdating += CommonValid;
            
            return dimensionUpdater;
        }

        private void dimensionUsed(BaseUpdater<DimensionModel> sender, DataDeletingEventArgs<DimensionModel> e)
        {
            if (e.Delete == null) return;
            //其他的待实现
        }
    }
}